package com.acme.bankapp;

import com.acme.bankapp.domain.Client;
import com.acme.bankapp.domain.Bank;
import com.acme.bankapp.domain.Gender;
/**
 * BankService class is designed to work with the administrator. All methods of this class duplicate class methods Bank with the changes:
 * 1) Methods public void withdrawClient(Bank bank, String FirstName, String LastName, double x), public void depositeClient(Bank bank, String FirstName, String LastName, double x),
 *  public void printClient(Bank bank, String FirstName, String LastName) pre-seeking client by name in the list of bank customers.
 *   After that call the corresponding method of the class Bank.
 * 2) The method public void addClient(Bank bank, String firstName, String lastName, double startBalance, double startOverdraft, Gender gender) first creates an instance of the class.
 * @author Troitskaya Aanastasia
 *
 */
public class BankService {
	public void printAllClients(Bank bank) {
		bank.printAllClients();
	}
	public void printBalance(Bank bank) {
		bank.printBalance();
	}
	public void addClient(Bank bank, String firstName, String lastName, double startBalance, double startOverdraft, Gender gender) {
		Client client = new Client(startBalance, gender, firstName, startOverdraft, lastName);
		if (client.getAccount() != null)
			bank.addClient(client);
	}
	public void withdrawClient(Bank bank, String FirstName, String LastName, double x) {
		bank.withdrawClient(bank.searchClient(FirstName, LastName), x);
	}
	public void depositeClient(Bank bank, String FirstName, String LastName, double x) {
		bank.depositeClient(bank.searchClient(FirstName, LastName), x);
	}
	public void printClient(Bank bank, String FirstName, String LastName) {
		bank.printClient(bank.searchClient(FirstName, LastName));
	}
	Client searchClient(String searchFirstName, String searchLastName, Bank bank) {
		return bank.searchClient(searchFirstName, searchLastName);
	}
}

